//
//  GYZFeaturedDetailTableViewCell.m
//  Qyer
//
//  Created by GYz on 15/10/26.
//  Copyright © 2015年 GF. All rights reserved.
//

#import "GYZFeaturedDetailTableViewCell.h"

@implementation GYZFeaturedDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.image = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, SCREEN_WIDTH - 20, SCREEN_WIDTH / 2)];
        [self.contentView addSubview:self.image];
        
        self.descriptionLabel = [[UILabel alloc] initWithFrame:CGRectZero];
        self.descriptionLabel.textColor = [UIColor lightGrayColor];
        self.descriptionLabel.font = [UIFont systemFontOfSize:13.0];
        self.descriptionLabel.numberOfLines = 0;
        [self.contentView addSubview:self.descriptionLabel];
        
        UIImageView *backView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.image.frame.size.width, self.image.frame.size.height)];
        [backView setImage:[UIImage imageNamed:@"backViewCell"]];
        [self.image addSubview:backView];
        
        self.chinsesName = [[UILabel alloc] initWithFrame:CGRectMake(10, SCREEN_WIDTH / 2 - 50, SCREEN_WIDTH - 40, 30)];
        self.chinsesName.textColor = [UIColor whiteColor];
        [backView addSubview:self.chinsesName];
        
    }
    return self;
}

- (void)setValueWithModel:(GYZFeaturedDetailModel *)model
{
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.photo] placeholderImage:[UIImage imageNamed:@"zhanweiPic"]];
    CGFloat height = [StringWithHeight HeightWithText:model.cDescription width:SCREEN_WIDTH - 20 font:[UIFont systemFontOfSize:13.0]];
    self.descriptionLabel.frame = CGRectMake(10, SCREEN_WIDTH / 2 + 20, SCREEN_WIDTH - 20, height);
    self.descriptionLabel.text = model.cDescription;
    self.chinsesName.text = model.chinesename;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
